import java.util.Calendar;

/**
 * checks credit card validation
 */


public class CreditCardControl 
{
	/** checks credit card validation */
	public void validate(boolean isBuyBooks)
	{
		boolean valid=false;
		Calendar cal = Calendar.getInstance(); 
		int month = cal.get(Calendar.MONTH) + 1; 
		int year = cal.get(Calendar.YEAR)%100; 
  		if(Main.creditInfo.year>year)
			valid=true;
		else if(Main.creditInfo.year==year)
			if(Main.creditInfo.month>=month)
				valid=true;
  		if(isBuyBooks)
  			Main.cart.valid(valid);		
  		else
  			Main.cart.chooseMembership(valid);
	}
	
}
